/**
 * File: ToppingFactory.java
 * Author: Eliana Feasley and Mark pallone
 * Emails: elf4@umbc.edu , markpa1@umbc.edu
 * Date: Jun 19, 2011
 * 
 * Description: Topping option and Topping generator. 
 */

package data;

import java.util.ArrayList;
import model.*;

/**
 * @author mark
 *
 */
public class ToppingFactory {
	
	public static final double TOPPING_COST = 1.00;
	public static final String[] ALL_TOPPINGS = {"hot fudge", "maraschino cherries", "whipped cream", "oreo", "caramel"};
	
	// indices into ALL_TOPPINGS
	public static final int HOT_FUDGE = 0;
	public static final int MARASCHINO_CHERRIES = 1;
	public static final int WHIPPED_CREAM = 2;
	public static final int OREO = 3;
	public static final int CARAMEL = 4;
	
	public ArrayList<String> getToppingOptions(Treat treat){
		ArrayList<String> options = new ArrayList<String>();
		
		if (treat instanceof IceCream) {
			options.add(ALL_TOPPINGS[HOT_FUDGE]);
			options.add(ALL_TOPPINGS[MARASCHINO_CHERRIES]);
			options.add(ALL_TOPPINGS[WHIPPED_CREAM]);
			options.add(ALL_TOPPINGS[OREO]);
			options.add(ALL_TOPPINGS[CARAMEL]);
		} else if (treat instanceof Sundae){
			options.add(ALL_TOPPINGS[HOT_FUDGE]);
			options.add(ALL_TOPPINGS[MARASCHINO_CHERRIES]);
			options.add(ALL_TOPPINGS[WHIPPED_CREAM]);
		} else if (treat instanceof Shake) {
			options.add(ALL_TOPPINGS[HOT_FUDGE]);
			options.add(ALL_TOPPINGS[MARASCHINO_CHERRIES]);
			options.add(ALL_TOPPINGS[WHIPPED_CREAM]);
		} else if (treat instanceof CoffeeDrink) {
			options.add(ALL_TOPPINGS[OREO]);
			options.add(ALL_TOPPINGS[CARAMEL]);
		} else if (treat instanceof Beverage) {
			// no topping for you!
		} else { 
			// default to no topping options
		}
		
		return options;
	}
	
	/**
	 * 
	 * getTopping - get topping object
	 * Preconditions: none
	 * Postconditions: topping object is returned
	 * @param toppingChoice choice of topping from getToppingOptions()
	 * @return Topping object
	 */
	public Topping getTopping(String toppingChoice) {
		Topping topping = new Topping(toppingChoice, TOPPING_COST);
		return topping;
	}
}
